package com.xoms.front.persist.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.xoms.front.model.ProOrderBean;
import com.xoms.front.persist.dao.ProOrderDao;

@Repository
public class ProOrderImpl extends BaseImpl implements ProOrderDao {
	final String NAME_SPACE = NAME_SPACE_HEADER + ".ProOrderMapper";

	@Override
	public int insertBatch(List<ProOrderBean> list) {
		if (list == null || list.size() == 0) {
			return 1;
		}
		Map<String, Object> where = new HashMap<>();
		where.put("list", list);
		return sqlSessionTemplate.insert(NAME_SPACE + ".insertBatch", where);
	}

	@Override
	public List<ProOrderBean> selectListByOid(String orderId) {
		Map<String, Object> where = new HashMap<>();
		where.put("orderId", orderId);
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectListByOid", where);
	}

	@Override
	public int updateStatusBatch(List<ProOrderBean> list) {
		if (list == null || list.isEmpty()) {
			return 1;
		}
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("list", list);
		return sqlSessionTemplate.update(NAME_SPACE + ".updateStatusBatch", params);
	}

}
